<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<title>emplist</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}" />
	</head>
	<body>
		<div id="wrap">
			<div id="top_content"> 
				<div id="header">
					<div id="rightheader">
						<p>
							2009/11/20 
							<br />
							<a href="">安全退出</a>
						</p>
					</div>
					<div id="topheader">
						<h1 id="title">
							<a href="#">main</a>
						</h1>
					</div>
					<div id="navigation">
					</div>
				</div>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						<div th:if="${session.user}">
							欢迎 <span   th:text="${session.user.getUsername()}"></span>
						</div>
						<div th:if="${session.user == null}">
							欢迎 <span   th:text="${session.user.getUsername()}">遊客</span>
						</div>
					</h1>
					<table class="table">
						<tr class="table_header">
							<td>
								编号
							</td>
							<td>
								姓名
							</td>
							<td>
								头像
							</td>
							<td>
								工资
							</td>
							<td>
								生日
							</td>
							<td>
								操作
							</td>
						</tr>

						<tr th:each="emp,state:${emplist}" th:class="${state.odd?'row2':'row1'}" >
							<td th:text="${emp.id}">

							</td>
							<td th:text="${emp.name}">

							</td>
							<td>
								<img th:src="@{/}+${emp.photo}" width="60">
							</td>
							<td th:text="${emp.salary}">

							</td>
							<td th:text="${#dates.format(emp.birthday,'yyyy-mm-dd')}">

							</td>
							<td>
								<a th:href="@{/emp/delete(id=${emp.id})}">删除</a>&nbsp;
								<!--如果多個參數-->
<!--								<a th:href="@{/emp/selectByid(id=${emp.id},name=${emp.name})}">更新</a>-->
								<!--參數拼接形式-->
<!--								<<a th:href="@{/emp/selectByid?id=}+${emp.id}+'&name='+${emp.name}">更新</a>-->

								<a th:href="@{/emp/selectByid(id=${emp.id})}">更新</a>
							</td>
						</tr>
					</table>
					<p>
						<input type="button" class="button" value="添加" onclick="jumpAdd()"/>
					</p>
				</div>
			</div>
			<div id="footer">
				<div id="footer_bg">
				ABC@126.com
				</div>
			</div>
		</div>
	<script type="text/javascript">
		function jumpAdd() {
			location.href = "[[@{/addEmp}]]"
		}
	</script>
	</body>

</html>
